/* stylelint-disable at-rule-no-unknown */
@import "../../../style/default";

/* apes-tag */
$tag-prefix-cls: #{$style-prefix}-tag;

.#{$tag-prefix-cls} {
  @include reset-component;
  display: inline-block;
  line-height: 20px;
  height: 22px;
  padding: 0 7px;
  border-radius: $border-radius-base;
  border: $border-width-base $border-style-base $border-color-base;
  background: $tag-default-bg;
  font-size: $tag-font-size;
  transition: all 0.3s $ease-out;
  opacity: 1;
  margin-right: 8px;
  cursor: pointer;
  white-space: nowrap;

  &:hover {
    opacity: 0.85;
  }

  &,
  a,
  a:hover {
    color: $tag-default-color;
  }

  > a:first-child:last-child {
    display: inline-block;
    margin: 0 -8px;
    padding: 0 8px;
  }

  .#{$iconfont-css-prefix}-cross {
    @include iconfont-size-under-12px(10);
    cursor: pointer;
    margin-left: 3px;
    transition: all .3s;
    color: $text-color-secondary;
    font-weight: bold;

    &:hover {
      color: $heading-color;
    }
  }

  &-has-color {
    border-color: transparent;

    &,
    a,
    a:hover,
    .#{$iconfont-css-prefix}-cross,
    .#{$iconfont-css-prefix}-cross:hover {
      color: #fff;
    }
  }

  &-checkable {
    background-color: transparent;
    border-color: transparent;

    &:not(&-checked):hover {
      color: $primary-color;
    }

    &:active,
    &-checked {
      color: #fff;
    }

    &-checked {
      background-color: $primary-6;
    }

    &:active {
      background-color: $primary-7;
    }
  }

  &-close {
    width: 0 !important;
    padding: 0;
    margin: 0;
  }

  &-zoom-enter,
  &-zoom-appear {
    animation: apesFadeIn .2s $ease-in-out-circ;
    animation-fill-mode: both;
  }

  &-zoom-leave {
    animation: apesZoomOut .3s $ease-in-out-circ;
    animation-fill-mode: both;
  }

  $colorsText: red, orange, yellow, yellowGreen, green, darkGreen, cyan, indigo, blue, purple, magenta, pink;
  $lightColorType: $red-1, $orange-1, $yellow-1, $yellowGreen-1, $green-1, $darkGreen-1, $cyan-1, $indigo-1, $blue-1, $purple-1, $magenta-1, $pink-1;
  $lightBorderColorType: $red-3, $orange-3, $yellow-3, $yellowGreen-3, $green-3, $darkGreen-3, $cyan-3, $indigo-3, $blue-3, $purple-3, $magenta-3, $pink-3;
  $darkColorType: $red-7, $orange-7, $yellow-7, $yellowGreen-7, $green-7, $darkGreen-7, $cyan-7, $indigo-7, $blue-7, $purple-7, $magenta-7, $pink-7;

  // mixin to iterate over colors and create CSS class for each one
  @mixin make-color-classes($i: length($colorsText)) {
    @if $i > 0 {
      @include make-color-classes($i - 1);
      $color: nth($colorsText, $i);
      $lightColor: nth($lightColorType, $i);
      $lightBorderColor: nth($lightBorderColorType, $i);
      $darkColor: nth($darkColorType, $i);
      &-#{$color} {
        color: $darkColor;
        background: $lightColor;
        border-color: $lightBorderColor;
      }
      &-#{$color}-inverse {
        background: $darkColor;
        border-color: $darkColor;
        color: #fff;
      }
    }
  }
  @include make-color-classes();

}
